{extend name="base/base-shop-layout"/}

{block name="linkCss"}
<link rel="stylesheet" href="__STATIC__/css/shop/shop.css">
<link rel="stylesheet" href="__STATIC__/css/shop/shop-form.css">
{/block}

{block name="breadcrumb"}
<a>商家管理中心</a>
<a> 店铺</a>
<a> 店铺分类</a>
{/block}

{block name="main"}
<div class="mlist">
    <div class="menu-bar">
        <ul>
            <li {eq name="op" value=""}class="active"{/eq}><a href="{:think\\Url::build('category')}">店铺分类</a></li>
            {eq name="op" value="add"}<li class="active"><a href="{:think\\Url::build('category','op=add')}">添加分类</a></li>{/eq}
        </ul>
        {eq name="op" value=""}<a class="layui-btn" href="{:think\\Url::build('category','op=add')}"><i class="iconfont icon-tianjia1"></i>添加分类</a>{/eq}
    </div>
    {if $op == ''}
    <div id="section1">
        <div class="table-wrap">
            <form class="layui-form" lay-verType="alert" id="form" method="post">
                <table class="table-list-style" width="100%" cellspacing="0" cellpadding="0">
                    <tbody>
                    <tr>
                        <th class="tl">
                            <label class="checkbox"><input lay-filter="checkall" lay-ignore="" class="checkall" type="checkbox"></label> 分类名称
                        </th>
                        <th width="80">排序</th>
                        <th width="80">是否显示</th>
                        <th width="120">操作</th>
                    </tr>

                    <tr>
                        <td class="tl">
                            <label class="checkbox">
                                <input lay-ignore="" class="checkitem" name="chk[]" value="331" type="checkbox">
                            </label>
                            <span>???</span>
                        </td>
                        <td>1</td>
                        <td>是</td>
                        <td>
                                        <span class="edit">
                                            <a href=""><i
                                                    class="iconfont icon-bianji"></i>编辑</a>
                                        </span>
                            <span class="del">
                                             <a lay-submit data-param="{'id':'331','m':'goods','s':'online'}" href="javascript:void(0)"><i class="iconfont icon-shanchu"></i>删除</a>
                                         </span>
                        </td>
                    </tr>

                    <tr>
                        <td class="toolBar" colspan="100">
                            <input name="act" value="del" type="hidden">
                            <label class="checkbox"><input lay-ignore="" lay-filter="checkall" class="checkall" type="checkbox">全选</label>
                            <span>|</span>
                            <label lay-submit class="del"><i class="iconfont icon-shanchu"></i>删除</label>
                            <div class="page">
                                <b>1</b>
                                <a href="?firstRow=10&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">2</a>
                                <a href="?firstRow=20&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">3</a>
                                <a href="?firstRow=30&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">4</a>
                                <a href="?firstRow=40&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">5</a>
                                <a href="?firstRow=50&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">6</a>
                                <a href="?firstRow=60&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">7</a>
                                <a href="?firstRow=70&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">8</a>
                                <a href="?firstRow=80&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">9</a>
                                <a href="?firstRow=90&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">10</a>
                                <a href="?firstRow=210&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">..22</a>
                                <a class="nextPage"
                                   href="?firstRow=10&amp;totalRows=217&amp;m=goods&amp;s=online&amp;key=">下一页</a>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
    {elseif $op == 'add'/}
    <div id="section2">
        <div class="add-wrap">
            <div class="pannel-content">
                <form action="" class="layui-form">
                    <ul>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label"><span class="req red">*</span>分类名称：</label>
                                <div class="layui-inline">
                                    <input lay-verify="required" name="catename" placeholder="请输入分类名称" class="layui-input">
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label"><span class="req red">*</span>是否显示：</label>
                                <div class="layui-inline">
                                    <input type="radio" name="display[]" value="1" title="是" checked="">
                                    <input type="radio" name="display[]" value="0" title="否">
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label">排序：</label>
                                <div class="layui-input-inline">
                                    <input name="sort" placeholder="" class="layui-input">
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="layui-form-item">
                                <label class="layui-form-label">

                                </label>
                                <div class="layui-input-block">
                                    <button class="layui-btn layui-btn-normal" lay-submit>确认提交</button>
                                </div>
                            </div>
                        </li>
                    </ul>
                </form>
            </div>
        </div>
    </div>
    {/if}
</div>
{/block}

{block name="linkBotScript"}
<script src="__STATIC__/js/shop.js"></script>
{/block}

{block name="botScript"}
<script>
    layui.use(['form'], function(){
        var form = layui.form;
        //表单验证
        form.verify({
            username: function(value, item){ //value：表单的值、item：表单的DOM对象
                if(!new RegExp("^[a-zA-Z\u4e00-\u9fa5\\s]+$").test(value)){
                    return '姓名不能有特殊字符';
                }else if(!/^[\S]{2,25}$/.test(value)){
                    return '姓名长度范围应在2到25之间';
                }
            }
        });
    });
</script>
{/block}